1 using System;
2 using
System.Collections.Generic;
3 using
System.Linq;
4 using
System.Text;
5 using
System.Threading.Tasks;
6
7 using
System.Security.Cryptography;
8
9 namespace
SoftQuanLyNhaHang.Models
10 {
11     
class UserControl
12     {
13         
public static string SHA256(string password)
14         {
15             
try
16             {
17                 SHA256Managed crypt =
new SHA256Managed();
18                 
string hash = String.Empty;
19                 
byte[] crypto = crypt.ComputeHash(Encoding.UTF8.GetBytes(password), 0,
20                     Encoding.UTF8.GetByteCount(password));
21                 
foreach (byte bit in crypto)
22                 {
23                     hash += bit.ToString(
"x2");
24                 }
25                 
return hash;
26             }
27             
catch
28             {
return null; }
29         }
30     }
31 }


Gõ tìm kiếm nhanh...